﻿@{
    Layout = "~/Views/Shared/_FormWhite.cshtml";
}

@*<div class="row cl">
        <div id="menuTree" class="ztree"></div>

    </div>*@
<style>
    .treeSearchInput {
        padding: 13px 0 0 20px;
    }
    .treeShowHideButton {
        position: absolute;
        right: 8px;
        top: 2px;
        font-size: 12px;
        color: #333;
        z-index: 3;
    }

    .treeExpandCollapse {
        float: right;
        margin: 6px 5px;
        padding: 5px;
        font-size: 12px;
        color: #333;
        position: relative;
        z-index: 2;
        background: #fff;
    }
</style>

<div class="wrapper">
    <div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
        <label id="btnShow" title="显示搜索" style="display:none;">︾</label>
        <label id="btnHide" title="隐藏搜索">︽</label>
    </div>
    <div class="treeSearchInput" id="search">
        <label for="keyword">关键字：</label><input type="text" class="empty" id="keyword" maxlength="50">
        <button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
    </div>
    <div class="treeExpandCollapse">
        <a href="#" onclick="$.tree.expand()">展开</a> /
        <a href="#" onclick="$.tree.collapse()">折叠</a>
    </div>
    <input id="treeId" type="hidden" value="" />
    <input id="treeName" type="hidden" value="" />
    <div id="tree" class="ztree treeselect"></div>
</div>

<script type="text/javascript">

    $(function () {
        var url ="/SystemManage/Menu/GetMenuTreeListJson";
        var options = {
            url: url,
            expandLevel: 1,
            onClick: zOnClick
        };
        $.tree.init(options);
    });

    function zOnClick(event, treeId, treeNode) {
        var treeId = treeNode.id;
        var treeName = treeNode.name;
        $("#treeId").val(treeId);
        $("#treeName").val(treeName);
    }
    @*$(function () {
        $('#menuTree').ysTree({
            id: "menuTree",
            url: '@Url.Content("~/SystemManage/Menu/GetMenuTreeListJson")',
            check: { enable: false },
            expandLevel: 0,
            callback: { onClick: saveChoose }
        });
    });

    function saveChoose(event, treeId, treeNode) {
        $("#treeId").val(treeNode.id);
        $("#treeName").val(treeNode.name);
    }*@
</script>